home *** CD-ROM | disk | FTP | other *** search
- property pSpriteList, pCurActive, pActive, pCallBackObj, pRefcon
-
- on new me, propList
- set pSpriteList to getaProp(propList, #sprites)
- set pCurActive to getaProp(propList, #cur)
- set pActive to getaProp(propList, #active)
- set pCallBackObj to getaProp(propList, #callback)
- set pRefcon to getaProp(propList, #ref)
- SetActive(me, pCurActive)
- if pCurActive > count(pSpriteList) then
- set pCurActive to 0
- end if
- return me
- end
-
- on click me, sNum
- if not pActive then
- exit
- end if
- if not integerp(sNum) then
- set sNum to the clickOn
- end if
- if the memberNum of sprite sNum < 1 then
- exit
- end if
- if not (the name of the member of sprite sNum contains "radioButton") then
- exit
- end if
- set memName to the name of the member of sprite sNum
- set the member of sprite sNum to member (memName && "Down")
- updateStage()
- set selected to 1
- repeat while the stillDown
- if rollOver(sNum) then
- set the member of sprite sNum to member (memName && "Down")
- set selected to 1
- else
- set the member of sprite sNum to member memName
- set selected to 0
- end if
- updateStage()
- end repeat
- set newNum to getPos(pSpriteList, sNum)
- SetActive(me, newNum)
- if objectp(pCallBackObj) then
- RadioClick(pCallBackObj, pRefcon, pCurActive)
- end if
- return pCurActive
- end
-
- on SetActive me, newNum
- set pCurActive to newNum
- repeat with i = 1 to count(pSpriteList)
- set sNum to getAt(pSpriteList, i)
- puppetSprite(sNum, 1)
- if i = pCurActive then
- set the member of sprite sNum to member "radioButton 1"
- next repeat
- end if
- set the member of sprite sNum to member "radioButton 0"
- end repeat
- end
-
- on SetEnabled me, enabled
- set pActive to enabled
- repeat with i in pSpriteList
- enableInterfaceElement(i, enabled)
- end repeat
- end
-
- on ThisYou me, sNum
- repeat with i = 1 to count(pSpriteList)
- if getAt(pSpriteList, i) = sNum then
- return 1
- end if
- end repeat
- return 0
- end
-
- on GetActiveRadio me
- return pCurActive
- end
-
- on Release me
- repeat with i = 1 to count(pSpriteList)
- puppetSprite(getAt(pSpriteList, i), 0)
- end repeat
- end
-